The namegen5 website.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

19 lines
415 B

import names, {collection} from './_names.js';
export function get(req, res) {
const name = names.find(n => n.name === req.params.name);
if (name == null) {
res.writeHead(404, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({code: 404, error: "Not found"}));
return;
}
res.writeHead(200, {
'Content-Type': 'application/json'
});
res.end(JSON.stringify({name, collection}));
}